/** */
package co.com.umobile.common.util;

import android.content.Context;
import co.com.umobile.R;
import co.com.umobile.network.URLServiceConnection;

/**
 * @author sergiogranada
 * 
 */
public class ServicesCodes {

	/** Subject update service. */
	public static final int SUBJECT_UPDATE = 0;

	/** Place update service. */
	public static final int PLACE_UPDATE = 1;

	/** Subject detail update service. */
	public static final int SUBJECT_DETAIL_UPDATE = 2;

	/** Notification update service. */
	public static final int NOTIFICATION_UPDATE = 3;

	/** All services. */
	public static final Integer[] SERVICES = { SUBJECT_UPDATE, PLACE_UPDATE, SUBJECT_DETAIL_UPDATE, NOTIFICATION_UPDATE };

	/**
	 * @return the services
	 */
	public static Integer[] getServices() {
		return SERVICES;
	}

	/**
	 * returns the urls by service code.
	 * 
	 * @param code
	 *            code.
	 * @param context
	 *            context.
	 * @return urls urls.
	 */
	public static String[] getServicesUrlsByServiceCode(int code, Context context) {

		String[] urls = null;

		switch (code) {
		case SUBJECT_UPDATE:

			urls = new String[] { URLServiceConnection.getURLService(context, URLServiceConnection.SUBJECT_LIST_URL) };

			break;
		case PLACE_UPDATE:

			urls = new String[] { URLServiceConnection.getURLService(context, URLServiceConnection.PLACE_LIST_URL) };

			break;

		case SUBJECT_DETAIL_UPDATE:

			urls = new String[] { URLServiceConnection.getURLService(context,
					URLServiceConnection.SUBJECT_DETAIL_LIST_URL) };

			break;

		case NOTIFICATION_UPDATE:

			urls = new String[] { URLServiceConnection.getURLService(context,
					URLServiceConnection.NOTIFICATION_LIST_URL) };

			break;
		default:
			break;
		}

		return urls;

	}

	/**
	 * returns the name related to the id.
	 * 
	 * @param id
	 *            Id.
	 * @return service id.
	 */
	public static int getIdNameById(int id) {

		switch (id) {
		case SUBJECT_UPDATE:
			return R.string.subject_label;
		case PLACE_UPDATE:
			return R.string.place_label;
		case SUBJECT_DETAIL_UPDATE:
			return R.string.details_subject_label;
		case NOTIFICATION_UPDATE:
			return R.string.notification_label;
		default:
			return 0;
		}

	}
}
